jQuery(function($){

	var menu_wrapper = $('#sp-menu-wrapper');
	$('.sp-mobile-menu').find('>ul').wrap('<div class="container" />');
	$('.sp-main-menu-toggler').appendTo(menu_wrapper.find('>.container'));
	$('.sp-mobile-menu').appendTo(menu_wrapper.find('>.container'));

	//Sticky Menu
	var windowWidth = $(window).width();
	if (windowWidth > 979){
		var stickyNavTop = menu_wrapper.offset().top;

		var stickyNav = function(){
			var scrollTop = $(window).scrollTop();

			if (scrollTop > stickyNavTop) {
				menu_wrapper.addClass('menu-fixed');
			}
			else
			{
				if(menu_wrapper.hasClass('menu-fixed'))
				{
					menu_wrapper.removeClass('menu-fixed');
				}

			}
		};

		stickyNav();

		$(window).scroll(function() {
			stickyNav();
		});
	}else{
		menu_wrapper.removeClass('menu-fixed');
	}

	//Weather Toggle
	$('.sp-weather-current').on('click', function(){
		$(this).next().slideToggle();
		$('.show-forcasts').toggleClass('icon-caret-up icon-caret-down')
	});

});